import { BackgroundColorModifier } from "./attribute/common/backgroundColor----test";
import { ArkColor } from "./entity/Color";
import { Modifier } from "./base/Modifier";

class ArkComponent extends Modifier {
    _modifiers: any;
    nativePtr: any;
    constructor(nativePtr: any) {
        super('');
        this._modifiers = new Map();
        this.nativePtr = nativePtr;
    }
    applyModifierPatch() {
        let expiringItems: any[] = [];
        this._modifiers.forEach((value: any, key: any) => {
            if (value.applyStage(this.nativePtr)) {
                expiringItems.push(key);
            }
        });

        expiringItems.forEach(key => {
            this._modifiers.delete(key);
        });
    }
    backgroundColor(value: any) {
        var arkColor = new ArkColor();
        if (arkColor.parseColorValue(value)) {
            this.modifier(this._modifiers, BackgroundColorModifier, arkColor.color);
        } else {
            this.modifier(this._modifiers, BackgroundColorModifier, undefined);
        }
        return this;
    }
}